package model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the Marca database table.
 * 
 */
@Entity
@NamedQuery(name="Marca.findAll", query="SELECT m FROM Marca m")
public class Marca implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int idMarca;

	private String descricao;

	private String potencia;

	//bi-directional many-to-one association to Automovel
	@OneToMany(mappedBy="marca")
	private List<Automovel> automovels;

	//bi-directional many-to-one association to Modelo
	@ManyToOne
	private Modelo modelo;

	public Marca() {
	}

	public int getIdMarca() {
		return this.idMarca;
	}

	public void setIdMarca(int idMarca) {
		this.idMarca = idMarca;
	}

	public String getDescricao() {
		return this.descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public String getPotencia() {
		return this.potencia;
	}

	public void setPotencia(String potencia) {
		this.potencia = potencia;
	}

	public List<Automovel> getAutomovels() {
		return this.automovels;
	}

	public void setAutomovels(List<Automovel> automovels) {
		this.automovels = automovels;
	}

	public Automovel addAutomovel(Automovel automovel) {
		getAutomovels().add(automovel);
		automovel.setMarca(this);

		return automovel;
	}

	public Automovel removeAutomovel(Automovel automovel) {
		getAutomovels().remove(automovel);
		automovel.setMarca(null);

		return automovel;
	}

	public Modelo getModelo() {
		return this.modelo;
	}

	public void setModelo(Modelo modelo) {
		this.modelo = modelo;
	}

}